#include <Architect.hpp>
#include "StreetBorder.hpp"

StreetBorder::StreetBorder()
{
  style = CLASSIC;
}

void StreetBorder::setBuiltIn()
{
  bv = new AABB(height, width, 100/*taille plus haut immeuble*/);
  
  int nb = minLvl + rand()%(maxLvl - minLvl);
  Pavement* p = dynamic_cast<Pavement*>(archi->get("G_PAVEMENT"));
  p->set(height, width, 0);
  addAsset(p);

  Building* b = dynamic_cast<Building*>(archi->get("G_BUILDING"));
  b->set(height-4, width-4, nb);
  b->translateOf(2, 2, 0.15);
  addAsset(b);
  
  float border = height -0.5;
  
  for(int wpos=width/8; wpos<7*width/8; wpos+=width/4)
  {
    Streetlight* l = dynamic_cast<Streetlight*>(archi->get("G_STREETLIGHT"));
    l->set(0.5, 3.5);
    l->translateOf(border, wpos, 0.15);
    addAsset(l);

	if (wpos % 5 == 0)
	{
		BusStop* b = dynamic_cast<BusStop*>(archi->get("G_BUSSTOP"));
		b->set();
		b->rotateOf(0, 0, 90);
		b->translateOf(border-0.2, wpos, 0.15);
		addAsset(b);
	}
  }
}
